<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
<title>带关闭按钮的滚动广告</title>
<style type="text/css">
#main{ text-align:center;}
#ss{
	position:absolute;
	left:30px;
	top:60px; 
	z-index:1;
	display: block;
	}
#close{
	position:absolute;
	top:60px;
	left:134px;
	z-index:2;
	cursor:hand;
	display: block;
	cursor: pointer;
}
</style>
</head>
<body>
<div id="close" onClick="adv_close()"><img src="images/close.jpg"></div>
<div id="ss"><img src="images/advpic.jpg"></div>
<div id="main"><img src="images/contentpic.jpg"></div>
<script>
var close = document.getElementById("close");
var ss = document.getElementById("ss");
     window.onscroll = function(){
     	close.style.top = parseInt(document.documentElement.scrollTop) + 60 +"px";
     	ss.style.top = parseInt(document.documentElement.scrollTop) + 60 + "px";
     	close.style.left = parseInt(document.documentElement.scrollLeft) + 134 + "px";
     	ss.style.left = parseInt(document.documentElement.scrollLeft) + 30 + "px";
     }
     adv_close = function(){
     	close.style.display = "none";
     	ss.style.display = "none";
     }
</script>
</body>
</html>
